Delete a string in the list box of a combo box
#Include <GuiCombo.au3>
_GUICtrlComboDeleteString($h_combobox, $i_index)
Parameters
h_combobox | control id/control hWnd |
$i_index | Specifies the zero-based index of the string |
Return Value
Success: | Returns value is a count of the strings remaining in the list. |
Failure: | Returns $CB_ERR if the $i_index parameter specifies an index greater than the number of items in the list. |
Remarks
None.
Related
_GUICtrlComboAddString, _GUICtrlComboInsertString, _GUICtrlComboResetContent
Example
#include <GuiConstants.au3>
#include <GuiCombo.au3>
Opt('MustDeclareVars',1)
Dim $Combo, $Btn_Delete, $Btn_Exit, $msg
GuiCreate("ComboBox Delete String", 392, 254)
$Combo = GuiCtrlCreateCombo("A", 70, 10, 270, 110,$CBS_SIMPLE)
$Btn_Delete = GuiCtrlCreateButton("Delete String", 135, 120, 90, 30)
GUICtrlSetData($Combo,"B|C|D|E|F")
$Btn_Exit = GuiCtrlCreateButton("Exit", 150, 180, 90, 30)
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
ExitLoop
Case $msg = $Btn_Delete
If(_GUICtrlComboGetCurSel($Combo) <> $CB_ERR) Then
_GUICtrlComboDeleteString($Combo,_GUICtrlComboGetCurSel($Combo))
EndIf
EndSelect
WEnd
Exit